import pop from '../utils/pop';
import env from '../config/env.js';

const ticket = localStorage.ticket;
const prefix = env.gwApiPrefix;
const errorHandler = error => {
	pop.error("加载数据失败！");
	console.log(error);
}

export default {
	//获取实训营列表
	getPractice(){
		return axios.get(`${prefix}/api/zsapi/practice/practices?ticket=${ticket}`).catch(errorHandler);
	},
	//获取实训营详情
	getPractice(practiceId){
		return axios.get(`${prefix}/api/zsapi/practice/practices/${practiceId}?ticket=${ticket}`).catch(errorHandler);
	},
	//获取实训营推荐列表
	getPracticeRecommend(practiceId){
		return`${prefix}/api/zsapi/practice/practices/recommend?practiceId=${practiceId}ticket=${ticket}`;
	}
}